<%@ page import="java.sql.*" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/3/31
  Time: 12:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>用户删除</title>
</head>
<body>
<p>跳转中....</p>
<%
    request.setCharacterEncoding("UTF-8");
    String id=request.getParameter("id");
    Connection connection=null;
    Statement statement=null;
    ResultSet resultSet=null;
    try {
        Class.forName("com.mysql.jdbc.Driver");
    }
    catch (ClassNotFoundException e){
        e.printStackTrace();
    }
    try {
        connection= DriverManager.getConnection("jdbc:mysql://localhost:3306/sctu_javaweb_2018?serverTimezone=UTC&characterEncoding=gbk","root","w19971201t" );
    statement=connection.createStatement();
    statement.executeUpdate("DELETE FROM t_user WHERE id="+id+"");
    }
catch (SQLException e){
        e.printStackTrace();
}
finally {
    try {
        connection.close();
        statement.close();

    }
    catch (SQLException e){
        e.printStackTrace();
    }
        }
%>
<jsp:forward page="userList.jsp"></jsp:forward>
<%--
<script type="text/javascript">

    onload=function () {
        setTimeout(go(),100);
    }
function go() {
   location.href="http://localhost:8080/userList.jsp"
}

</script>
--%>
</body>
</html>
